enum Color { Red, Green, Blue }
let c: Color = Color.Green;

// 默认情况下，从0开始为元素编号。也可以手动的指定成员的数值
enum Color { Red1 = 1, Green1, Blue1 }
let c1: Color = Color.Green1;
// or
enum Color { Red2 = 1, Green2, Blue2 }
let c2: Color = Color.Green2;

enum Color { Red3 = 1, Green3, Blue3 }
let colorName: string = Color[2];
alert(colorName);